package tiandang.core.dao;

import org.apache.ibatis.annotations.Param;
import tiandang.core.model.Product;

import java.util.List;

public interface ProductMapper {
  int deleteByPrimaryKey(Integer id);

  int insert(Product record);

  int insertSelective(Product record);

  Product selectByPrimaryKey(Integer id);

  int updateByPrimaryKeySelective(Product record);

  void setDownline(@Param("id") Integer id, @Param("downline") Integer downline);

  List<Product> getListByParams(@Param("name") String name, @Param("limit") Integer limit, @Param("offset") Integer offset);

  int countByParams(@Param("name") String name);

  List<Product> getListByName(@Param("name") String name);

  List<Product> getListByIdList(@Param("idList") List<Integer> idList);

  int increaseSales(@Param("id") Integer id, @Param("amount") Integer amount);

  int decreaseSales(@Param("id") Integer id, @Param("amount") Integer amount);

  int countAllProducts();

  List<Product> getAllNormal();
}